<template>
	<view>
		<nav-header bgColor="bg-custom-color" :isBack="true">
			<block slot="backText">{{$t('back')}}</block>
			<block slot="content">{{$t('safetyCenter.title')}}</block>
		</nav-header>

		<view class="cu-list menu card-menu margin-top">
			<view class="cu-item arrow" @click="$common.toPage('../safetyCenter/update_password')">
				<view class="content">
					<text class=" text-grey"></text>
					<text class="text-grey">{{$t('safetyCenter.updateLoginPassword')}}</text>
				</view>
			</view>
			<view class="cu-item arrow" @click="$common.toPage('../safetyCenter/update_safety_password')">
				<view class="content">
					<text class=" text-grey"></text>
					<text class="text-grey">{{$t('safetyCenter.updateSafetyPassword')}}</text>
				</view>
			</view>
			
			
		</view>
	</view>
</template>

<script>
	var t
	export default {
		data() {
			return {
				userInfo: {},
				userId: '',
				user_logo: 'http://www.kaowei.org/content-phone/images/img_head.png',
				modalName: null,
				language: [{
						name: '简体中文',
						value: 'zh-CN'
					},
					{
						name: 'English',
						value: 'en-US'
					}
				]
			};
		},
		onLoad() {
			t = this;
			this.$i18n.locale = t.$common.localRead("local")
			t.userInfo = $common.getUser()
			if (!t.userInfo) {
				$common.notLoginUser()
			}
		},
		methods: {
			chooseLanguage: function(item) {
				console.info(111)
				this.$i18n.locale = item.value
				$common.localSave('local', item.value);
				this.hideModal();
			},
			hideModal(e) {
				this.modalName = null
			},
			getData: function() {
				if (!this.userId) {
					uni.showToast({
						title: "uuid参数不正确",
						duration: 1500,
						icon: 'none'
					})
					return false;
				}
				uni.request({
					url: this.ctx + "m/UserInfo.do?method=getUserInfo",
					data: {
						uuid: this.userId,
					},
					success: (res) => {
						console.info(res);
						if (res.data.code != 200) {
							uni.showToast({
								title: res.data.msg,
								duration: 1500,
								icon: 'none'
							})
							return false;
						}

						if (null != res.data.data.userInfo) {
							this.userInfo = res.data.data.userInfo;
							console.info(this.userInfo)
							if (this.userInfo.user_logo) {
								this.user_logo = this.userInfo.user_logo;
								console.info(this.user_logo);
							}

							uni.setStorageSync('userId', res.data.data.userInfo.uuid);
							uni.setStorageSync('userInfo', JSON.stringify(res.data.data.userInfo));
							this.userId = uni.getStorageSync('userId');
						}
					}
				});
			},
			back() {
				$common.delUser();
				$common.toPage(this.$base.pagePath().login.login, 3, 500)
			}
		}

	}
</script>

<style>
	.top {
		height: 200upx;
	}

	.userInfo {
		float: left;
		margin-left: 20px;
		text-align: left;
	}

	.top-img-view {
		text-align: center;
		padding: 20px;
	}

	.user-name {
		padding: 20upx 0;
		color: white;
	}

	.content {
		height: 100%;
	}

	.nav .cu-item {
		padding: inherit;
		height: 120upx;
		line-height: 120upx;
		position: relative;
	}

	.cu-tag.badge {
		top: 6upx;
		right: -6upx;
	}

	.back {
		position: fixed;
		width: 100%;
		bottom: 10px;
	}

	.text-grey {
		color: #E3E8FB;
	}

	.cu-list.menu>.cu-item {
		background-color: #121E2E;
	}

	.bg-cyan {
		background-color: #121e2e;
		color: #E3E8FB;
	}
</style>
